﻿using BootstrapBlazor.Components;
using SqlSugar;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

namespace OnWork.DataCenter.Shared.Pages.DataSource
{
    /// <summary>
    /// 视图类
    /// </summary>
    public class MQTTConfigVO
    {
        /// <summary>
        /// 主键
        /// </summary>
        [AutoGenerateColumn(Visible = false, Readonly = true)]
        public long ID { get; set; }

        /// <summary>
        /// 数据连接名称
        /// </summary>
        [Required(ErrorMessage = "{0}不能为空"), MaxLength(255)]
        [AutoGenerateColumn(Text = "连接名", Searchable = true, Filterable = true, Sortable = true), DisplayName("连接名")]
        public string Name { get; set; }

        /// <summary>
        /// 服务Ip代理地址
        /// </summary>
        [Required(ErrorMessage = "{0}不能为空"), MaxLength(100)]
        [AutoGenerateColumn(Text = "地址"), DisplayName("地址")]
        public string BrokerAddress { get; set; }

        /// <summary>
        /// 服务Ip代理端口号
        /// </summary>
        [Required(ErrorMessage = "{0}不能为空")]
        [AutoGenerateColumn(Text = "端口号"), DisplayName("端口号")]
        public int BrokerPort { get; set; } = 1883;

        /// <summary>
        /// 客户端ID
        /// </summary>
        [Required(ErrorMessage = "{0}不能为空")]
        [AutoGenerateColumn(Text = "客户端ID"), DisplayName("客户端ID")]
        public string ClientID { get; set; } = Guid.NewGuid().ToString("N");

        /// <summary>
        /// 用户名
        /// </summary>
        [AutoGenerateColumn(Text = "用户名"), DisplayName("用户名")]
        public string UserName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        [AutoGenerateColumn(Text = "密码"), DisplayName("密码")]
        public string? Password { get; set; }
    }
}